import threading as td
import time
def job(x,y,f):
    for i in range(x,y):
        f.write(str(i) + '\n')
        print(i)
    time.sleep(0.01)
def start():
    with open(r'C:\Users\Administrator\Desktop\l.txt', 'a+') as book:
        t1 = td.Thread(target=job, args=(  0, 25000,book))
        t2 = td.Thread(target=job, args=(25000, 50000,book))
        t3 = td.Thread(target=job, args=(50000, 75000,book))
        t4 = td.Thread(target=job, args=(75000, 100000, book))
        t1.start()
        t2.start()
        t3.start()
        t4.start()
        t1.join()
        t2.join()
        t3.join()
        t4.join()

if __name__ == '__main__':
    time1 = time.time()
    start()
    time2 = time.time()
    print(time2 - time1)